package com.sgs.carbon.web.modules.common.mq.consumer.permission;

import com.sgs.carbon.starter.mq.core.pubsub.AbstractChannelMessageListener;
import com.sgs.carbon.web.modules.common.mq.message.permission.SysRoleRefreshMessage;
import com.sgs.carbon.web.modules.common.service.permission.SysRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 针对 {@link SysRoleRefreshMessage} 的消费者
 *
 * @author Dave Liu
 * @date 2021-10-07
 */
@Slf4j
@Component
public class SysRoleRefreshConsumer extends AbstractChannelMessageListener<SysRoleRefreshMessage> {

    @Autowired
    private SysRoleService roleService;

    @Override
    public void onMessage(SysRoleRefreshMessage message) {
        log.info("[onMessage][收到 Role 刷新消息]");
        roleService.initLocalCache();
    }

}
